package com.sy.controller.user;

import com.sy.CourseService;
import com.sy.CourseUserService;
import com.sy.result.Result;
import com.sy.vo.CourseIndexVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 课程管理
 */
@Api(tags = "用户端-课程管理相关接口")
@RestController("userCourseController")
@RequestMapping("/user/course")
@Slf4j
public class CourseController {

    @Autowired
    private CourseService courseService;
    @Autowired
    private CourseUserService courseUserService;

    @ApiOperation("用户端主页课程查询")
    @GetMapping("/findAll")
    public Result<List<CourseIndexVO>> findAllSales(){
        log.info("课程销量排序查询:");
        // 调用业务获取数据
        List<CourseIndexVO> allSales = courseService.findAllSales();
        return Result.success(allSales);
    }
}
